/*
 * Agent.h
 *
 *  Created on: 14 Feb 2012
 *      Author: mohab
 */

#ifndef AGENT_H_
#define AGENT_H_

#include <string>
#include <vector>
#include <functional>
#include "Commands.h"
#include "World.h"

using namespace std;

/*enum struct CMD_RESULT
 {
 Produced,
 Consumed
 };*/

class Agent {
public:
	Agent();
	virtual ~Agent();

	bool interpretCommand(const char* cmd, bool * produced); // result is true if produced // TODO: WTF?!! string.h
	void interpretCommunicationCommand(const char* str);
	void communicate(const char* str);//will be used by Plan to communicate
	bool pickPuck(int puckNo, int location);
	bool move(int location);
	bool insertPuck(int location);
	bool pickProduct(int location);
	int getDistanceToMachine(int machineNo); // Motion planning w/obstacles w/o other agents
	World* world;
	list<string> intents;
	int location; // Location of the agent in the world.
	int* m1Discovered;
	int* m2Discovered;
	int* m3Discovered;
	bool synched; // Indicates whether all other agents have this agent's latest information.
	bool handFree; // Indicates whether this agent is carrying a puck.

	int puckNo; // The ID of the puck held by the agent. Only valid if handFree is false.
	int puckType; // The type of the puck held by the agent. Only valid if handFree is false.
};

#endif /* AGENT_H_ */
